package com.medisched.medisched.controller;

import com.medisched.medisched.domain.Holiday;
import com.medisched.medisched.service.IHolidayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 假期Controller
 * 
 * @author ruoyi
 * @date 2025-05-15
 */
@CrossOrigin
@RestController
@RequestMapping("/system/holiday")
public class HolidayController
{
    @Autowired
    private IHolidayService holidayService;

    /**
     * 查询假期列表
     */
    @GetMapping("/list")
    public List<Holiday> list(Holiday holiday)
    {
        return holidayService.selectHolidayList(holiday);
    }


    /**
     * 获取假期详细信息
     */
    public Holiday getInfo(@PathVariable("id") Long id)
    {
        return holidayService.selectHolidayById(id);
    }

    /**
     * 新增假期
     */
    @PostMapping
    public int add(@RequestBody Holiday holiday)
    {
        return holidayService.insertHoliday(holiday);
    }

    /**
     * 修改假期
     */
    @PutMapping
    public int edit(@RequestBody Holiday holiday)
    {
        return holidayService.updateHoliday(holiday);
    }

    /**
     * 删除假期
     */
	@DeleteMapping("/{ids}")
    public int remove(@PathVariable Long[] ids)
    {
        return holidayService.deleteHolidayByIds(ids);
    }
}
